﻿<?php
session_start();
//kiem tra co dang nhap hay khong
include("ktdangnhap.php");
?>
<html>
<head>
<title>Chủ đề kiểm tra</title>
<link rel="stylesheet" href="menu.css" type="text/css">
<link rel="stylesheet" href="kt.css" type="text/css">
</head>
<body>
<?php
//lay menu


if(isset($_GET["id"]))
{
	include("menu.php");
	$id=$_GET["id"];
	//ket noi voi co so du lieu
	include("connect.php");
	//cau lenh sql
	$sql="select * from kiemtra where MA_MON=$id";
	$query=mysql_query($sql);
	if(mysql_num_rows($query)==0)
	{
		echo"Chưa có bài kiểm tra nào trong môn này";
	}
	else
	{
		$sql1="select * from mon where MA_MON=$id";
		$query1=mysql_query($sql1);
		$row1=mysql_fetch_array($query1);
		echo "<table align='center'>";
		echo "<tr><td><h2>".$row1["TEN_MON"]."</h2></td></tr>";
		while($row=mysql_fetch_array($query))
		{
			echo"<tr><td><a href='kt.php?id=".$row["MA_KT"]."'>".$row["TEN_KT"]."</a></td></tr>";
		}
		echo "</table>";
	}
}
else
{
	header("location:index.php");
}
?>
</body>
</html>